<?php

namespace app\company\validate;


class DeliverDriverValidate extends BaseValidate
{
    public function __construct()
    {
        $rule = [
            'name'              => 'require|max:50',
            'mobile'            => 'require|unique:deliver_driver|mobile',
            'sex'               => 'require|in:0,1,2',
            'user_name'         => 'require|unique:deliver_driver|max:50',
            "deliver_driver_id" => "require|number",
            "money"             => "require|number",
        ];

        $message = [
            'name.require'      => '姓名不能为空',
            'name.max'          => '姓名长度不能超过50个字符',
            'mobile.require'    => '手机号不能为空',
            'mobile.unique'     => '手机号已存在',
            'mobile.mobile'     => '手机号格式错误',
            'sex.require'       => '性别不能为空',
            'sex.in'            => '性别格式错误',
            'user_name.require' => '用户名不能为空',
            'user_name.unique'  => '用户名已存在',
            'user_name.max'     => '用户名长度不能超过50个字符',
            "deliver_driver_id.require" => '司机id不能为空',
            "money.require" => '提现金额不能为空',
            "money.number" => '提现金额必须为数字'
        ];

        $scene = [
            'add' => ['name', 'mobile', 'sex', 'user_name'],
            'withdraw' => ['money', 'deliver_driver_id'],
        ];
        parent::__construct($rule, $message, $scene);
    }
}